package com.zz.mybatis.session.defaults;

import com.zz.mybatis.binding.MapperRegistry;
import com.zz.mybatis.session.SqlSession;

/**
 * @author ZHOUZHEN
 * @date 2023/7/7
 */

public class DefaultSqlSession implements SqlSession {

    private MapperRegistry mapperRegistry;

    public DefaultSqlSession(MapperRegistry mapperRegistry) {
        this.mapperRegistry = mapperRegistry;
    }

    @Override
    public <T> T selectOne(String statement) {
        return (T)("你被代理了:"+ statement);
    }

    @Override
    public <T> T selectOne(String statement, Object parameter) {
        return (T)("你被代理了:方法:"+ statement + "入参:" + parameter);
    }

    @Override
    public <T> T getMapper(Class<T> clazz) {
        return mapperRegistry.getMapper(clazz,this);
    }
}
